package me.huqiao.loganlyzer.console;

public class ConsoleColor {
    /**
     * -f logFilePath
     *
     * 蓝色：\u001B[34m
     *
     * 青色：\u001B[36m
     *
     * 红色：\u001B[31m
     *
     * 绿色：\u001B[32m
     *
     * 白色：\u001B[37m
     *
     * 黄色：\u001B[33m
     *
     * 黑色：\u001B[30m
     *
     * 洋红色：\u001B[35m
     *--------------------背景
     * 蓝色：\u001B[44m
     *
     * 青色：\u001B[46m
     *
     * 黑色：\u001B[40m
     *
     * 红色：\u001B[41m
     *
     * 白色：\u001B[47m
     *
     * 绿色：\u001B[42m
     *
     * 黄色：\u001B[43m
     *
     * 洋红色：\u001B[45m
     *
     * +~~~~~~+~~~~~~+~~~~~~~~~~~+
     * |  fg  |  bg  |  color    |
     * +~~~~~~+~~~~~~+~~~~~~~~~~~+
     * |  30  |  40  |  black    |
     * |  31  |  41  |  red      |
     * |  32  |  42  |  green    |
     * |  33  |  43  |  yellow   |
     * |  34  |  44  |  blue     |
     * |  35  |  45  |  magenta  |
     * |  36  |  46  |  cyan     |
     * |  37  |  47  |  white    |
     * |  39  |  49  |  default  |
     * +~~~~~~+~~~~~~+~~~~~~~~~~~+
     * @param args
     */
    public static String RESET = "\u001B[0m";
    public static String RED = "\u001B[31m";
    public static String GREEN = "\u001B[32m";
    public static String YELLOW = "\u001B[33m";
    public static String BLUE = "\u001B[34m";
    public static String WHITE = "\u001B[37m";

    // String RESET = "\u001B[0m";
    public static String RED_TEXT = "\u001B[31m";
    public static String GREEN_TEXT = "\u001B[32m";
    public static String YELLOW_TEXT = "\u001B[33m";
    public static String BLACK_BG = "\u001B[40m";
    public static String WHITE_BG = "\u001B[47m";

    //默认10个长度
    public static String EMPTH_STR="          ";

    public static String getFixStr(String str,int length){
        if(-1==length){
            return str;
        }else if(str.length()>length){
            return str.substring(0,length);
        }else{
            return str+EMPTH_STR.substring(0,length-str.length());
        }
    }
    public static String getWhiteBg(String str,int length){
        return WHITE_BG+getFixStr(str,length)+RESET;
    }
    public static String getWhiteBoard(String str,int length){
        return WHITE+getFixStr(str,length)+RESET;
    }
    public static String getBlue(String str,int length){
        return BLUE+getFixStr(str,length)+RESET;
    }
}
